<template>
	<view class="page-index">
    <view class="header">
      <view :style="{height: statusBarHeight}"></view>
      <view class="header-content flex aic">
        <image class="logo" src="/static/2images/logo.png"></image>
		<view class="nav-title">玄天湖文旅</view>
      </view>
    </view>
    <view :style="{height: statusBarHeight}"></view>
    <view style="height: 44px"></view>
		<view class="page_content">
			<view class="container">
				<view class="label">手机号码：</view>
				<view class="text"><input v-model="phone" placeholder="请输入手机号码"/></view>
				<!-- <view class="label">座位号：</view>
				<view class="text"><input v-model="location" placeholder="请输入座位号"/></view> -->
			</view>
			<view class="button" @click="search()">查询</view>
			<view class="result">
				
				<view class="item" v-for="n in data">
					<view class="row">
						<view class="section">
							<view class="label">姓名：</view>
							<view class="text">{{n.user_name}}</view>
						</view>
						<view class="section">
							<view class="label">座位数：</view>
							<view class="text">{{n.total}}张</view>
						</view>
					</view>
					<view class="row">
						<view class="section">
							<view class="label">取票码：</view>
							<view class="text">{{n.code}}</view>
						</view>
						<view class="section">
							<view class="label">状态：</view>
							<view class="text" v-if="n.status == 0">待支付</view>
							<view class="text" v-if="n.status == 1">已支付</view>
							<view class="text" v-if="n.status == 2">退款成功</view>
							<view class="text" v-if="n.status == 3">退款拒绝</view>
						</view>
					</view>
					<view class="row">
						<view class="section">
							<view class="label">手机号码：</view>
							<view class="text">{{n.phone}}</view>
						</view>
						<view class="section">
							<view class="label">金额：</view>
							<view class="text">{{n.price}}</view>
						</view>
					</view>
				</view>
			</view>
		
		</view> 
    <!-- #ifdef MP -->
    <authorize @onLoadFun="onLoadFun" :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize>
    <!-- #endif -->
    <view class="full-auth" v-if="!userInfo.uid" @tap="openAuto"></view>
	</view>
</template>

<script>
var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
import {
  getArticleHotList,
  getIndexData
} from "@/api/api.js";
import {
  search
} from "@/api/show_order.js";
import {
		getconfig,
		history
	} from '@/api/public.js'
  import dataList from "@/mixins/dataList";
import {
		plantformNotifyList
	} from "@/api/2_activity";
// #ifdef MP
import authorize from '@/components/Authorize';
import {getUserInfo} from "@/api/user";
// #endif

const app = getApp()
export default {
  components: {authorize},

    mixins: [dataList],

		data() {
			return {
				notice_text:'最新公告：2022年3月15日博巴汽修平台正式上线，欢迎大家使用！',
				showBuy: app.globalData.temp_status != 1,
				statusBarHeight,
				isAuto: false, //没有授权的不会自动授权
				isShowAuth: false, //是否隐藏授权
				userInfo: {},
				notify_text:'',
				notify_id:'',//通知公告id
				imgUrls: [],
				swiperCur: 0,
				circular: true,
				autoplay: true,
				interval: 3000,
				duration: 500,
				noticeTimer: null,
				noticeCount:5,
				menus: [
					{
						image: '/static/2images/2_1.png',
						url: '/pages/2_development/store/index',
						name: '餐饮预订',
						show: true,
					},{
						image: '/static/2images/2_2.png',
						url: '/pages/2_development/hotel/list',
						name: '酒店预订',
						show: true,

					},
					// {
					// 	image: '/static/2images/2_3.png',
					// 	url: '/pages/2_development/activity/index',
					// 	name: '活动',
					// 	show: true,

					// }, 
					

					{
						image: '/static/2images/scenic.png',
						url: '/pages/2_development/scenic/index',
						name: '景区',
						show: true,
					},
					{
						image: '/static/2images/2_5.png',
						url: '/pages/index/index',
						name: '商城',
						show: true,
					},
					{
						image: '/static/2images/2_4.png',
						url: '/pages/2_development/show_buy_ticket/index',
						name: '追梦·铜梁龙',
						show: true,
					},
					{
						image: '/static/2images/water.png',
						url: '/pages/2_development/water/index',
						name: '水上乐园',
						show: true,
					}
					// ,

					// {
					// 	image: '/static/2images/2_5.png',
					// 	url: '/pages/2_development/show_buy_ticket/index',
					// 	name: '更多',
					// 	show: true,

					// }
				],
				phone:'',
				location:'',
				data:undefined,
			};
		},
		onLoad() {

		},
    onShow(){
      this.getUserInfo()
    },
	onShareTimeline() {
		return {
			title: '玄天湖文旅',
			//分享朋友圈的参数
			query: "isShare=1&id=",
		}
	},
	onShareAppMessage(){
	},
		methods: {
			search(){
				let type = 0;
				if(this.phone.length != 0){
					type = 0;
				}else{
					type = 1;
				}
				let that = this;
				search({
					phone:this.phone,
					location:this.location,
					type:type
				}).then(res => {
					that.data = res.data;
					console.info(res)
				});
			},
		  /**
		   * 获取个人用户信息
		   */
		  getUserInfo: function() {
			let that = this;
			getUserInfo().then(res => {
			  that.userInfo = res.data,
				  that.is_promoter = res.data.is_promoter
			  that.extension_status = res.data.extension_status
			});
		  },
		  // 打开授权
		  openAuto() {
			this.isAuto = true;
			this.isShowAuth = true
		  },
		  // 授权回调
		  onLoadFun() {
			this.getUserInfo();
			this.isShowAuth = false
		  },
		  // 授权关闭
		  authColse: function(e) {
			this.isShowAuth = e
		  },
		},
	};
</script>

<style lang="scss">
	@import "./index.scss";
  page{
    background: #f8f8f8;
  }
  .header{
    background: linear-gradient(180.00deg, #0093ff 0%, #81ceff 100%);
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 9;
    .header-content{
      height: 44px;
      padding-left: 20px;
	  
	  .nav-title{
		  font-family: "Source Han Sans CN";
		  font-weight: bold;
		  font-size: 17.2px;
		  text-align: left;
		  color: #fff;
		  margin-left: 3px;
	  }
    }
    .logo{
      width: 39px;
      height: 21px;
    }
  }

  .notice-bar{
    background: #fff;
    padding: 8px 14px;
    margin-bottom: 10px;
    margin-top: 10px;
    .notice{
      height: 38px;
      border-radius: 19.28px;
      background: #fff;
      border: 1px solid #dcdcdc;
      padding-left: 10px;
      padding-right: 10px;
	  display: flex;
	  flex-direction: row;
	  align-items: center;
    }
    .image{
      width: 73.05px;
      height: 14.97px;
      margin-right: 15px;
    }
    .text{
      font-size: 14px;
      line-height:1;
      color: #333;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
  }

	.page-index {
		.page_content {
			margin-top: 0;
			.nav .item{
				width: 33.33%;
			}
		}

	}
	
	.container{
		display: flex;
		flex-direction: column;
		background-color: white;
		padding: 30rpx;
		.label{
			height: 100rpx;
			display: flex;
			flex-direction: row;
			align-items: center;
		}
		.text{
			border: 1px solid #f1f1f1;
			input{
				padding: 15rpx;
			}
		}
		
	}
	.button{
		margin: 30rpx;
		background-color: #0093ff;
		color: white;
		padding: 25rpx 0rpx;
		text-align: center;
		border-radius: 15rpx;
	}
	.result{
		padding: 30rpx;
		display: flex;
		flex-direction: column;
		.item{
			display: flex;
			flex-direction: column;
			background-color: white;
			padding: 30rpx;
			margin-bottom: 10rpx;
			.row{
				display: flex;
				flex-direction: row;
				align-items: center;
				.section{
					display: flex;
					flex-direction: row;
					flex: 1;
					.label{
						width: 150rpx;
					}
					.text{
						font-size: 28rpx;
						
					}
				}
			}
		}
	}
</style>
